import React, { Component } from 'react'
import classnames from 'classnames'
import { Link } from 'react-router-dom';
import { routes } from '../router';
import styles from './Tab.module.scss'

export default class Tab extends Component {

  render() {
    const { pathname } = window.location
    console.log(pathname)
    return (
      <div className={styles.tab}>
        <div>
          {routes.map((item, i) => {
            return (
              <Link
                className={classnames([{ [styles.span_active]: pathname === `${item.path}` }])} key={i}
                to={item.path}
              >
                {item.title}
              </Link>
            )
          })}
        </div>
      </div>
    )
  }
}
